import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class SudokuUI extends JFrame 
{
	private static SudokuUI sodokuInstance = null;
	
	private SudokuCore sudokuCore;
	private SudokuGrid sudokuGrid;
	private SudokuMenuBar sudokuMenu;	

		
	private SudokuUI()
	{
		super("Sudoku");	
		setBounds(10,10,620,580);
		setResizable(false);
		this.addWindowListener(new WindowAdapter()
			{
			public void windowClosing(WindowEvent e){System.exit(0);}
			});
		
		sudokuCore = new SudokuCore();					
		sudokuGrid = new SudokuGrid(sudokuCore);
		sudokuMenu = new SudokuMenuBar();
		SudokuActionHandler.createSudokuHandlerInstance(sudokuCore,sudokuGrid,sudokuMenu);		
		
		setJMenuBar(sudokuMenu);			
		getContentPane().add(sudokuGrid);
		setVisible(true);								
	}
		
		
	private synchronized static void effectuerSynchro()
	{
		if (sodokuInstance == null)
		{
			sodokuInstance = new SudokuUI();
		}
	}
	
	public static SudokuUI getSudokuInstance()
	{
		effectuerSynchro();
		return sodokuInstance;
	}
	

}

